package kr.hkit.androidcomplete02.ch13;

import kr.hkit.androidcomplete02.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;

public class Window_ProgressBarEx extends Activity {
	int mProg;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_PROGRESS);
		requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
		setContentView(R.layout.ch13_window_progressbar);
				
		mProg = 5000;
		setProgress(mProg);
		setProgressBarVisibility(true);
		
	}
	public void mOnClick(View v){
		switch(v.getId()){
		case R.id.dec_progress:
			if(mProg >= 200)
				mProg -= 200;
			setProgress(mProg);
			break;
		case R.id.inc_progress:
			if(mProg <= 9800)
				mProg += 200;
			setProgress(mProg);
			break;
			
		case R.id.start_circle:
			setProgressBarIndeterminateVisibility(true);
			break;
			
		case R.id.stop_circle:
			setProgressBarIndeterminateVisibility(false);
			break;
		}
	}
}
